import Service from '@/api/service'
export default {
  data() {
    return {
      servicePath: '/system/parameter'
    }
  },
  computed: {
    moduleService(servicePath) {
      return new Service(this.servicePath)
    }
  },
  methods: {
    tabOptions(setup, parent) {
      this.$set(parent ? this.$parent : this, 'tab_options', [{
        value: '1',
        label: '系统配置',
        isShow: 'true'
      }, {
        value: '2',
        label: '七牛云配置',
        isShow: setup.upload_type === '2' ? 'true' : 'false'
      }])
    },
    submitInfo(formName, form) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.moduleService['add'](form).then(res => {
            this.$message.success('操作成功')
            this.tabOptions(form.setup, 'parent')
          })
        } else {
          return false
        }
      })
    }
  }
}
